﻿using System;
using System.Net;
using System.Net.Sockets;
using System.IO;

namespace zmMoniter
{
    /// <summary>
    /// 传递线程中相关数据
    /// </summary>
    public class ThreadPack
    {

        #region -- 私有变量 --

        private byte[] buffer;
        private ClientInfo clientInfo;
        private MemoryStream memStream;
        private IPEndPoint iep;

        

        #endregion

        #region -- 属性 --

        /// <summary>
        /// 收到的字节数组
        /// </summary>
        public byte[] Buffer
        {
            get { return buffer; }
            set { buffer = value; }
        }

        /// <summary>
        /// 客户端信息
        /// </summary>
        public ClientInfo ClientInfo
        {
            get { return clientInfo; }
            set { clientInfo = value; }
        }
        /// <summary>
        /// 接受内存块
        /// </summary>
        public MemoryStream MemStream
        {
            get { return memStream; }
            set { memStream = value; }
        }
        /// <summary>
        /// 客户端登录时存放客户端的IpEndPoint
        /// </summary>
        public IPEndPoint Iep
        {
            get { return iep; }
            set { iep = value; }
        }

        #endregion

        #region -- 方法 --

        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="buffer">接受到的字节数组</param>
        /// <param name="ns">网络流</param>
        public ThreadPack(byte[] buffer, ClientInfo clientInfo, MemoryStream memStream)
        {
            this.buffer = buffer;
            this.clientInfo = clientInfo;
            this.memStream = memStream;
            this.iep = (IPEndPoint)clientInfo.Client.Client.RemoteEndPoint;
        }

        #endregion

    }
}
